package forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class ReviewerChoiceForm extends ActionForm{

	private static final long serialVersionUID = 1L;
	private String gradeSelect = null;
	private String gradeComments = null;
	
	public String getGradeSelect() {
		return gradeSelect;
	}

	public void setGradeSelect(String gradeSelect) {
		this.gradeSelect = gradeSelect;
	}

	public String getGradeComments() {
		return gradeComments;
	}

	public void setGradeComments(String gradeComments) {
		this.gradeComments = gradeComments;
		
	}

	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
		ActionErrors errors = new ActionErrors();
		
		if (gradeSelect == null || gradeSelect.length() < 1)
			errors.add("gradeSelectMsgTagl", new ActionMessage("errors.required", "Please choose a grade 1-4"));
		if (gradeComments == null || gradeComments.length() < 1)
			errors.add("gradeCommentsMsgTagl", new ActionMessage("errors.required", "Please add a comment about the applicant"));

		
		return errors;
	}

}
